package com.hnqcgczy.ssy.db;

import java.sql.Connection;
import java.sql.SQLException;

public class MyTransaction {
    private Connection connection;

    public MyTransaction(boolean is) {
        try {
            this.connection.setAutoCommit(is);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }

    /**
     * 获取设置了事务的数据库链接
     * @return
     */
    public Connection getConnection(){
        return connection;
    }
    public void closeConn(){
        try {
            if (connection!=null&&connection.isClosed());
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
/*    public void setConnection(boolean is){
        try {

        MyConnection myConnection=new MyConnectiom();//组件
        this.connection=myConnection.getConnectionByMysql();

            this.connection.setAutoCommit(is);//设置数据库链接的一个属性值
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}*/
